import { Controller, Post, Get, Body } from '@nestjs/common'
import { RolesService } from './roles.service'

@Controller('roles')
export class RolesController {
  constructor(private rolesService: RolesService) {}

  @Post('/insertRole')
  async insertRole(@Body() data: any) {
    return this.rolesService.insertMany([data])
  }

  @Get('/findRoles')
  async findRoles() {
    return this.rolesService.find()
  }

  @Post('/updateRole')
  async updateRole(@Body() data: any) {
    return this.rolesService.updateOne(data)
  }

  @Post('/deleteRole')
  async deleteRole(@Body() data: any) {
    return this.rolesService.deleteOne(data)
  }
}
